package com.yn.xgame.message;

import com.yn.xgame.IMessage;
import com.yn.xgame.pb.ClientGateProto;
import com.yn.xgame.pb.GateClientProto;
import com.yn.xgame.pb.MessageIdProto;
import io.netty.channel.ChannelHandlerContext;

/**
 * Client - Gate message
 * Created by wangboo on 17/7/12.
 */
public class C2GPbMessage implements IMessage {

    private ChannelHandlerContext ctx;
    private ClientGateProto.C2GMessage pb;

    public C2GPbMessage(ChannelHandlerContext ctx, ClientGateProto.C2GMessage pb) {
        this.pb = pb;
        this.ctx = ctx;
    }

    public ClientGateProto.C2GMessage getPb() {
        return pb;
    }

    public MessageIdProto.MessageId getMsgId() {
        return pb.getMsgid();
    }

    public ChannelHandlerContext getCtx() {
        return ctx;
    }

    public void send(GateClientProto.G2CMessage resp) {
        ctx.writeAndFlush(resp);
    }

}
